package com.fitz.remote.codec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class RpcEncoder extends MessageToByteEncoder {

    private byte serializerType;

    public RpcEncoder(byte serializerType) {
        this.serializerType = serializerType;
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
       Codec.INSTANCE.encode(msg,out,serializerType);
    }
}
